import Vue from 'vue'
import Router from 'vue-router'  // 引入定义好的router
import Welcome from '../views/Welcome.vue'
import Login from '../views/user/Login.vue'
import Home from '../views/Home.vue'
import Item from '../views/category/Item.vue'
import Product from '../views/category/Product.vue'
import OrderList from '../views/order/OrderList.vue'
import AccountInfo from '../views/user/AccountInfo.vue'
import OrderInfo from '../views/order/OrderInfo.vue'
import Category from '../views/category/Category.vue'
import OrderStatus from '../views/order/OrderStatus.vue'
import Add from '../views/category/Add.vue'


Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Welcome',
      component: Welcome,

    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
    },
    {
      path: '/home/:name',
      name: 'Home',
      component:Home,
      children:[
        {
          path: '/goHome/:name',
          redirect: '/home/:name'
        }
      ]
    },
    {
      path: '/item/:id',
      name: 'Item',
      component:Item,
    },
    {
      path: '/product/:id',
      name: 'Product',
      component:Product,
    },
    {
      path: '/orderList',
      name: 'OrderList',
      component:OrderList,

    },
    {
      path:'/orderInfo/:id',
      name:'OrderInfo',
      component:OrderInfo,
    },
    {
      path: '/accountInfo',
      name: 'AccountInfo',
      component:  AccountInfo,
    },
    {
      path: '/category',
      name: 'Category',
      component:  Category,
    },
    {
      path: '/orderStatus/:orderId',
      name: 'OrderStatus',
      component:  OrderStatus,
    },
    {
      path: '/category/add/:type',
      name: 'Add',
      component:  Add,
    }
  
  ]
})

